﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace Collaboration_System
{
    public partial class MainWindow : Window
    {
        private string config = @"config.json";
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var timer = new DispatcherTimer
            { Interval = TimeSpan.FromSeconds(6) };
            timer.Start();
            timer.Tick += (sender1, args) =>
            {
                timer.Stop();
                if (!File.Exists(config))
                {
                    Autorization autorization = new Autorization();
                    autorization.Show();
                    this.Close();
                }
                else
                { 
                    Dashboard dashboard = new Dashboard();
                    dashboard.Show();
                    this.Close();
                }

            };
        }
    }
}
